package api

import (
	"github.com/gin-gonic/gin"
	"user/api/hander"
	"user/consts"
	"user/pkg"
)

func LoadRouter(r *gin.Engine) {
	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/register", hander.Register)
			user.POST("/login", hander.Login)
			user.POST("./list", hander.List)
			user.POST("./upload", hander.Upload)
		}
		room := api.Group("/room")
		{
			room.POST("./list", hander.ListRoom)
			room.POST("./out", hander.OutRoom)
			room.POST("./addNum", hander.AddNum)
			room.Use(pkg.JWTAuth(consts.JWT_KEY))
			room.POST("./add", hander.AddRoom)
			room.POST("./update", hander.UpdateRoom)
			room.POST("./addFan", hander.AddFan)

		}
	}
}
